<?php

/**
 * Created by PhpStorm.
 * User: li
 * Date: 15-11-2
 * Time: 下午12:25
 */
class MY_Action_Controller extends MY_Rest_Controller
{
    function __construct(){
        parent::__construct();
        $this->auth();
    }

    function get_login_user($key=null){
        if($key){
            return $this->_login_user[$key];
        }
        return $this->_login_user;
    }

    function auth(){
        $status = $this->input->get('auth_type');
        if($status=='auth'){
            $user_id = $_GET['user_id'];
            $token = $_GET['token'];
            $this->load->library('Api_auth');
            $this->api_auth->decode($user_id,$token);
            $this->_login_user = $this->api_auth->get_user();
            if(!$this->_login_user){
                $this->set_response(10403);
            }
        }else{
            //$this->load->library('Auth_nuan');
            $this->_login_user = @$_SESSION['login_user'];
            if(!$this->_login_user){
                $this->set_response(10403);
            }
        }
    }




}